<div class="grid" loading #loading>
    <div hidden><ng-content></ng-content></div>
    <table>
        <thead>
            <tr>
                <th *ngFor="let column of columns;" [ngStyle]="{
                    width: column.width
                }">
                    <ng-container [ngSwitch]="getColumnModel(column)">

                        <s-checkbox *ngSwitchCase="'checkbox'" (onClick)="handleClickHeadCheckbox($event)" [checked]="isSelectAll"></s-checkbox>

                        <ng-container *ngSwitchCase="'row-number'">
                            {{ rowNumberTitle }}
                        </ng-container>

                        <ng-container *ngSwitchDefault>
                            {{column.title}}
                        </ng-container>
                    </ng-container>
                </th>
            </tr>
        </thead>
        <tbody>
            <tr *ngFor="let record of store;let i = index;" [ngClass]="{
                isSelected: record.checked
            }">
                <td *ngFor="let column of columns">
                    <ng-container [ngSwitch]="getColumnModel(column)">

                        <s-checkbox *ngSwitchCase="'checkbox'" (onClick)="handleClickRowCheckbox($event, record)" [checked]="record.checked"></s-checkbox>

                        <ng-container *ngSwitchCase="'row-number'">
                            {{ i + 1 }}
                        </ng-container>

                        <ng-container *ngSwitchCase="'template'">
                            <!-- $implicit，定义未绑定变量名的变量的值 -->
                            <ng-template
                                [ngTemplateOutlet]="column.tplRef" [ngTemplateOutletContext]="{
                                '$implicit': record,
                                store: store
                            }"></ng-template>
                        </ng-container>

                        <ng-container *ngSwitchDefault>
                            {{record.name}}
                        </ng-container>
                    </ng-container>
                </td>
            </tr>
        </tbody>
    </table>
</div>
